<% layout('/layouts/default.html', {title: '到单押汇查询', libs: ['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text('到单押汇详情')}
				<% if (billNegotiated.status1=="1"){ %>
                    <% if (hasPermi('financial:billnegotiated:billNegotiated:bfd')){ %>
                    <a href="${ctx}/financial/billnegotiated/billNegotiated/discrepancies?billNegotiatedId=${billNegotiated.billNegotiatedId}" id="discrepancies"
                       class="btn btn-primary addTabPage" title="${text('不符点')}"
                       data-layer="true" data-layer-width="400" data-layer-height="200"
                    > ${text('不符点')}</a>
                    <% } %>

                    <% if (hasPermi('financial:billnegotiated:billNegotiated:khhk')&&(billNegotiated.customerActualRepaymentDate == "" || billNegotiated.customerRealExchangeRate == "")){ %>
                    <a href="${ctx}/financial/billnegotiated/billNegotiated/customerRemittance?billNegotiatedId=${billNegotiated.billNegotiatedId}" id="khhh"
                       class="btn btn-primary addTabPage" title="${text('客户还汇')}"
                       data-layer="true" data-layer-width="400" data-layer-height="400"
                    > ${text('客户还汇')}</a>
                    <% } %>

                    <% if (hasPermi('financial:billnegotiated:billNegotiated:zfhh')&&(billNegotiated.investorActualRepaymentDate == "" || billNegotiated.investorRealExchangeRate == "")){ %>
                    <a href="${ctx}/financial/billnegotiated/billNegotiated/investorRemittance?billNegotiatedId=${billNegotiated.billNegotiatedId}" id="zfhh"
                       class="btn btn-primary addTabPage" title="${text('资方还汇')}"
                       data-layer="true" data-layer-width="400" data-layer-height="400"
                    > ${text('资方还汇')}</a>
                    <% } %>

                    <% if (hasPermi('financial:billnegotiated:billNegotiated:bzjhl')&&billNegotiated.marginPurchaseExchangeRate == ""){ %>
                        <a href="${ctx}/financial/billnegotiated/billNegotiated/marginConfirm?billNegotiatedId=${billNegotiated.billNegotiatedId}" id="bzjqr"
                           class="btn btn-primary addTabPage" title="${text('保证金汇率')}"
                           data-layer="true" data-layer-width="400" data-layer-height="200"
                        > ${text('保证金汇率')}</a>
                    <% } %>

                    <% if (hasPermi('financial:billnegotiated:billNegotiated:gjysbxf')&&(billNegotiated.interArId == null || billNegotiated.interApId == null)){ %>
                    <button type="button" class="btn btn-primary" id="inter"> ${text('国际运输保险费')}</button>
                    <% } %>

                    <% if (hasPermi('financial:billnegotiated:billNegotiated:cancel')){ %>
                    <button type="button" class="btn btn-primary" id="cancel"> ${text('作废')}</button>
                    <% } %>
				<% } %>
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${billNegotiated}" action="${ctx}/financial/billnegotiated/billNegotiated/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('车辆信息')}</div>
				<#form:hidden path="billNegotiatedId"/>
				<#form:hidden path="ladingBillId"/>
				<#form:hidden path="tentativeExchangeRate"/>
				<#form:hidden path="investorInterestRatio"/>
				<#form:hidden path="customerInterestRatio"/>
				<#form:hidden path="investorYearDays"/>
				<#form:hidden path="interArId"/>
				<#form:hidden path="interApId"/>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('车架号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="frameNumber" items="${frameNumberList}" onchange="frameNumberChange()"
								itemLabel="frameNumber" itemValue="frameNumber"  class="form-control required" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('品牌')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="brand" dictType="car_pinpai" blankOption="true" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('版型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="area" dictType="car_quyu" blankOption="true" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('车型')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="model" maxlength="100" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('价格（原币种）')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="unitPrice" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('币种')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="currency" dictType="sys_bizhong" blankOption="true" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('状态')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('状态')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="status1" dictType="bill_negotiated_status" blankOption="true" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('押汇主体信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('编号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="billNegotiatedCode" maxlength="100" class="form-control" placeholder="自动生成" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('信用证')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="letterCreditCode" items="${listLetterCredit}"
								itemLabel="letterCreditCode" itemValue="letterCreditId" blankOption="true" class="form-control " readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('服务订单')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="serviceOrderCode" items="${listServiceOrder}"
								itemLabel="serviceOrderCode" itemValue="serviceOrderId" blankOption="true" class="form-control required" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('委托协议')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="entrustAgreement" maxlength="100" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:treeselect id="customer" title="${text('客户选择')}"
								path="customer.customerId" labelPath="customer.customerName"
								url="${ctx}/base/customer/customer/treeData" canSelectRoot="true" canSelectParent="true"
								class=" required" allowClear="true"  readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('国内资方')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="investorId" items="${gnzfList}" itemLabel="supplierName" itemValue="supplierId"
								class="form-control required" blankOption="true" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('资方押汇方案')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="investorNegotiatedPlan" itemLabel="name" itemValue="id" readonly="true"
								class="form-control" blankOption="true" />
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('外贸合同号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="foreignTradeContractNumber" maxlength="100" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('保证金购汇汇率')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="marginPurchaseExchangeRate" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('押汇比例')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="negotiatedRatio" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('押汇金额')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="negotiatedAmount" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('押汇信息-资方')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('开始日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="startDate" readonly="true" maxlength="20" class="form-control  required"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd" data-done="startDateChange()"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('资方结束日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorEndDate" readonly="true" maxlength="20" class="form-control  required"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('客户结束日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerEndDate" readonly="true" maxlength="20" class="form-control  required"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('是否N+1')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="n1Flag" dictType="sys_yes_no" blankOption="true" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('资方押汇期应还款利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="amount"  class="form-control number" readonly="true" dataFormat="number2"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户押汇期应还款利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerAmount"  class="form-control number" readonly="true" dataFormat="number2"/>
							</div>
						</div>
					</div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('资方年利率')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="supplieryearrate" class="form-control number" readonly="true"/>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4" title="">
                                <span class="required hide">*</span> ${text('客户年利率')}：<i class="fa icon-question hide"></i></label>
                            <div class="col-sm-8">
                                <#form:input path="customeryearrate" class="form-control number" readonly="true"/>
                            </div>
                        </div>
                    </div>
				</div>
				<div class="ml10 mr10">
					<table id="billNegotiatedDetailDataGrid1"></table>
					<!--					<% if (hasPermi('financial:billnegotiated:billNegotiated:edit')){ %>-->
					<!--					<a href="#" id="billNegotiatedDetailDataGridAddRowBtn1" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> ${text('增行')}</a>-->
					<!--					<% } %>-->
				</div>
				<div class="form-unit">${text('押汇信息-客户')}</div>
				<div class="ml10 mr10">
					<table id="billNegotiatedDetailDataGrid2"></table>
					<!--					<% if (hasPermi('financial:billnegotiated:billNegotiated:edit')){ %>-->
					<!--					<a href="#" id="billNegotiatedDetailDataGridAddRowBtn2" class="btn btn-primary btn-sm mt10 mb10"><i class="fa fa-plus"></i> ${text('增行')}</a>-->
					<!--					<% } %>-->
				</div>
				<div class="form-unit">${text('计算')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('押汇本金（RMB）')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="negotiatedAmountRmb" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('资方押汇利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorNegotiatedInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户押汇利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerNegotiatedInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('资方延期利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorNegotiatedYqInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户延期利息')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerNegotiatedYqInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('资方本息合计')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorTotalPrincipalInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户本息合计')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerTotalPrincipalInterest" class="form-control number" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('还汇信息-资方')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('实际还汇日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorActualRepaymentDate" readonly="true" maxlength="20" class="form-control"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('实际汇率')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorRealExchangeRate" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('预估汇率')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorEstimatedExchangeRate" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
<!--					<div class="col-xs-6">-->
<!--						<div class="form-group">-->
<!--							<label class="control-label col-sm-4" title="">-->
<!--								<span class="required hide">*</span> ${text('预估价格')}：<i class="fa icon-question hide"></i></label>-->
<!--							<div class="col-sm-8">-->
<!--								<#form:input path="investorEstimatedPrice" class="form-control number" readonly="true"/>-->
<!--							</div>-->
<!--						</div>-->
<!--					</div>-->
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('预付单')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="prepaymentId"  items="${listPrepayment}" itemLabel="prepaymentCode"
								itemValue="prepaymentId" blankOption="true" class="form-control " readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('发生天数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="investorActualDays" class="form-control digits" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('还汇应付单')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="investorPayableId" items="${listAp}" itemLabel="apCode"
								itemValue="apId" blankOption="true"  class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('还汇信息-客户')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('实际还汇日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerActualRepaymentDate" readonly="true" maxlength="20" class="form-control"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('实际汇率')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerRealExchangeRate" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('预估汇率')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerEstimatedExchangeRate" maxlength="10" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
<!--					<div class="col-xs-6">-->
<!--						<div class="form-group">-->
<!--							<label class="control-label col-sm-4" title="">-->
<!--								<span class="required hide">*</span> ${text('预估价格')}：<i class="fa icon-question hide"></i></label>-->
<!--							<div class="col-sm-8">-->
<!--								<#form:input path="customerEstimatedPrice" class="form-control number" readonly="true"/>-->
<!--							</div>-->
<!--						</div>-->
<!--					</div>-->
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('预收单')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="advancesReceivedId"  items="${listAdvancesReceived}" itemLabel="advancesReceivedCode"
								itemValue="advancesReceivedId" blankOption="true" class="form-control " readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('发生天数')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="customerActualDays" class="form-control digits" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('还汇应收单')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="customerReceivableId"  items="${listAr}" itemLabel="arCode"
								itemValue="arId" blankOption="true"  class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<h4 class="form-unit">${text('附件上传')}</h4>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">
								<span class="required hide">*</span> ${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${billNegotiated.id}" bizType="billNegotiated_file"
								uploadType="all" class="" readonly="false" preview="true"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required hide">*</span> ${text('不符点说明')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-10">
								<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
				</div>
				<h4 class="form-unit">${text('系统信息')}</h4>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('创建者')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="createBy" maxlength="64" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('创建时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="createDate" readonly="true" maxlength="20" class="form-control "
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('更新者')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="updateBy" maxlength="64" class="form-control" readonly="true"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('更新时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="updateDate" readonly="true" maxlength="20" class="form-control"
								dataFormat="date" data-type="date" data-format="yyyy-MM-dd"/>
							</div>
						</div>
					</div>
				</div>
				<div class="form-unit">${text('相关财务记录')}</div>
				<div class="ml10 mr10">
					<table id="billNegotiatedDetailDataGrid3"></table>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
//初始化到单押汇明细DataGrid对象
$("#billNegotiatedDetailDataGrid1").dataGrid({
    data: ${toJson(billNegotiated.billNegotiatedDetailList1)},
    datatype: "local", // 设置本地数据
    autoGridHeight: function(){return 'auto'}, // 设置自动高度

    // 设置数据表格列
    columnModel: [
        {header:'状态', name:'status', editable:true, hidden:true},
        {header:'主键', name:'billNegotiatedDetailId', editable:true, hidden:true},
        {header:'${text("发生天数")}', name:'days', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control digits', 'readonly':'true'}},
        {header:'${text("押汇日期起")}', name:'startDate', width:150,
            formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
            editable:true, edittype:'text', editoptions:{'class':'form-control', 'readonly':'true',
                dataInit: function(element){
                    laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
                }
            }
        },
        {header:'${text("押汇日期至")}', name:'endDate', width:150,
            formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
            editable:true, edittype:'text', editoptions:{'class':'form-control', 'readonly':'true',
                dataInit: function(element){
                    laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
                }
            }
        },
        {header:'${text("资方-保证金比例")}', name:'marginRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("资方-保证金金额")}', name:'marginAmount', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'}},
        {header:'${text("资方-押汇利率")}', name:'negotiatedRate', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("资方-押汇利息")}', name:'negotiatedInterest', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'}},
        // {header:'${text("资方-应还款金额")}', name:'repaymentAmount', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'},
        // 	formatter:'number', formatoptions:{thousandsSeparator:',', decimalPlaces:2, defaulValue:''}},
        {header:'${text("备注")}', name:'remark', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'255', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("到单押汇ID")}', name:'billNegotiatedId.billNegotiatedId', editable:true, hidden:true},
        {header:'${text("预付单ID")}', name:'prepaymentId', editable:true, hidden:true},
        {header:'${text("操作")}', name:'actions', width:80, sortable:false, fixed:true,
            formatter: function(val, obj, row, act){
                var actions = [];
                if(row.prepaymentId == null){
                    <% if (hasPermi('financial:billnegotiated:billNegotiated:bzjyf')){ %>
                    actions.push('<a href="#" onclick="bzjyf(\''+obj.rowId+'\')">展期保证金预付</a>&nbsp;');
                    <% } %>
                }
                return actions.join('');
            }, editoptions: {defaultValue: 'new'}}
    ],

    // 编辑表格参数
    editGrid: false,				// 是否是编辑表格
    editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
    editGridAddRowBtn: $('#billNegotiatedDetailDataGridAddRowBtn1'),	// 子表增行按钮
    editGridAddRowInitData: {billNegotiatedDetailId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

    // 编辑表格的提交数据参数
    editGridInputFormListName: 'billNegotiatedDetailList', // 提交的数据列表名
    editGridInputFormListAttrs: 'status,billNegotiatedDetailId,days,startDate,endDate,marginRatio,marginAmount,negotiatedRate,negotiatedInterest,repaymentAmount,remark,type,billNegotiatedId.billNegotiatedId,', // 提交数据列表的属性字段

    // 加载成功后执行事件
    ajaxSuccess: function(data){

    }
});
$("#billNegotiatedDetailDataGrid2").dataGrid({
    data: ${toJson(billNegotiated.billNegotiatedDetailList2)},
    datatype: "local", // 设置本地数据
    autoGridHeight: function(){return 'auto'}, // 设置自动高度

    // 设置数据表格列
    columnModel: [
        {header:'状态', name:'status', editable:true, hidden:true},
        {header:'主键', name:'billNegotiatedDetailId', editable:true, hidden:true},
        {header:'${text("发生天数")}', name:'days', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control digits', 'readonly':'true'}},
        {header:'${text("押汇日期起")}', name:'startDate', width:150,
            formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
            editable:true, edittype:'text', editoptions:{'class':'form-control', 'readonly':'true',
                dataInit: function(element){
                    laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
                }
            }
        },
        {header:'${text("押汇日期至")}', name:'endDate', width:150,
            formatter:'date', formatoptions:{srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'},
            editable:true, edittype:'text', editoptions:{'class':'form-control', 'readonly':'true',
                dataInit: function(element){
                    laydate.render({elem:element, type:'date', format:'yyyy-MM-dd'});
                }
            }
        },
        {header:'${text("客户-保证金比例")}', name:'marginRatio', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("客户-保证金金额")}', name:'marginAmount', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'}},
        {header:'${text("客户-押汇利率")}', name:'negotiatedRate', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'10', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("客户-押汇利息")}', name:'negotiatedInterest', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'}},
        // {header:'${text("客户-应还款金额")}', name:'repaymentAmount', width:150, editable:true, edittype:'text', editoptions:{'class':'form-control number', 'readonly':'true'},
        // 	formatter:'number', formatoptions:{thousandsSeparator:',', decimalPlaces:2, defaulValue:''}},
        {header:'${text("备注")}', name:'remark', width:150, editable:true, edittype:'text', editoptions:{'maxlength':'255', 'class':'form-control', 'readonly':'true'}},
        {header:'${text("到单押汇ID")}', name:'billNegotiatedId.billNegotiatedId', editable:true, hidden:true},
        {header:'${text("预收单ID")}', name:'advancesReceivedId', editable:true, hidden:true},
        {header:'${text("操作")}', name:'actions', width:80, sortable:false, fixed:true, formatter: function(val, obj, row, act){
                    var actions = [];
                    if(row.advancesReceivedId == null){
                        <% if (hasPermi('financial:billnegotiated:billNegotiated:bzjys')){ %>
                        actions.push('<a href="#" onclick="bzjys(\''+obj.rowId+'\')">展期保证金预收</a>&nbsp;');
                                <% } %>
                    }
                    return actions.join('');
            }, editoptions: {defaultValue: 'new'}}
    ],

    // 编辑表格参数
    editGrid: false,				// 是否是编辑表格
    editGridInitRowNum: 0,		// 编辑表格的初始化新增行数
    editGridAddRowBtn: $('#billNegotiatedDetailDataGridAddRowBtn2'),	// 子表增行按钮
    editGridAddRowInitData: {billNegotiatedDetailId: '', status: Global.STATUS_NORMAL},	// 新增行的时候初始化的数据

    // 编辑表格的提交数据参数
    editGridInputFormListName: 'billNegotiatedDetailList', // 提交的数据列表名
    editGridInputFormListAttrs: 'status,billNegotiatedDetailId,days,startDate,endDate,marginRatio,marginAmount,negotiatedRate,negotiatedInterest,repaymentAmount,remark,type,billNegotiatedId.billNegotiatedId,', // 提交数据列表的属性字段

    // 加载成功后执行事件
    ajaxSuccess: function(data){

    }
});
$("#billNegotiatedDetailDataGrid3").dataGrid({
		data: ${toJson(billNegotiated.relatedRecordList)},
		datatype: "local", // 设置本地数据
		autoGridHeight: function(){return 'auto'}, // 设置自动高度

		// 设置数据表格列
		columnModel: [
			{header:'${text("单据编号")}', name:'billCode', width:300},
			{header:'${text("日期")}', name:'date', width:150, },
			{header:'${text("费用项目")}', name:'expenseItem', width:150, editable:true, edittype:'text'},
			{header:'${text("应收金额")}', name:'yingshouAmount', width:150, editable:true, edittype:'text'},
			{header:'${text("应付金额")}', name:'yingfuAmount', width:150, editable:true, edittype:'text'},
			{header:'${text("预收金额")}', name:'yushouAmount', width:150, editable:true, edittype:'text'},
			{header:'${text("预付金额")}', name:'yufuAmount', width:150, editable:true, edittype:'text'},
		],

		// 编辑表格参数
		editGrid: false,				// 是否是编辑表格

		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
</script>
<script>
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
$(function (){
	var t = $("#investorRealExchangeRate").val();
	if(t == null|| t == ''){
		$("#inter").attr("style", "display:none;");
	}
});
frameNumberChange();
function frameNumberChange() {
    $.ajax({
        type : "post",
        async : false,
        url : "${ctx}/financial/billnegotiated/billNegotiated/getList",
        data : {
            'supplierId' : $("#investorId").val()
        },
        dataType : "json",
        success : function(msg) {
            $("#investorNegotiatedPlan").empty();
            if (msg.length > 0) {
                for (let i = 0; i < msg.length; i++) {
                    let partId = msg[i].investorFinancialInfoId;
                    let partName = msg[i].groupName;
                    let option = $("<option>").attr({"value" : partId}).text(partName);
                    $("#investorNegotiatedPlan").append(option);
                }
                $("#investorNegotiatedPlan option:first").prop("selected", 'selected');
                $("#investorNegotiatedPlan").change();
            }
        },
        error : function(json) {
            $.jBox.alert("网络异常！");
        }
    });
}

function bzjyf(rowId) {
	js.confirm('确认生成展期保证金预付吗？', function(data){
		let id = $("#billNegotiatedDetailDataGrid1").jqGrid("getCell",rowId,"billNegotiatedDetailId");
		$.ajax({
			type: "POST",
			async : false,
			url: "${ctx}/financial/billnegotiated/billNegotiated/bzjyf",
			data: {"billNegotiatedDetailId": id},
			success: function (data) {
				js.showMessage(data.message);
				location.reload();
			}
		});
	});
}

$("#inter").click(function(){
	js.confirm('确认生成国际运输保险费吗？', function(data){
		$.ajax({
			type: "POST",
			async : false,
			url: "${ctx}/financial/billnegotiated/billNegotiated/inter",
			data: {"billNegotiatedId": $("#billNegotiatedId").val()},
			success: function (data) {
				js.showMessage(data.message);
				location.reload();
			}
		});
	});
});

$("#cancel").click(function(){
    js.confirm('确认作废吗？', function(data){
        $.ajax({
            type: "POST",
            async : false,
            url: "${ctx}/financial/billnegotiated/billNegotiated/cancel",
            data: {"billNegotiatedId": $("#billNegotiatedId").val()},
            success: function (data) {
                js.showMessage(data.message);
                location.reload();
            }
        });
    });

});

</script>
